<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	pageContext.setAttribute("path", path);
	pageContext.setAttribute("basePath", basePath);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath %>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加员工</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <script type="text/javascript" src="assets/js/jquery.min.js"></script>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/app.js"></script>
    <script src="assets/js/jquery.js"></script>
   
    <script>
        function f1(k){
            var a=document.getElementById(k);
            a.style.borderColor="#c10802";
        }

    </script>
    <script type="text/javascript">
    var a1 = 0;
	var a2 = 0;
	var a3 = 0;
	var a4 = 0;
	var a5 = 0;
	var a6 = 0;
    
	var p = 0;
	var c = 0;
	var t = 0;
	
    $(function(){
    	province();
        function province(){
            $.post("city/province",function(data){
                if(data!=null&&data.length>0){
                    for(var i=0;i<data.length;i++){
                        $("#province").append("<option value="+data[i].provice_id+">"+data[i].provice_name+"</option>");
                    }
                }
            });
        }
    	
    	$("#province").change(function city(){
            var prov_id = $(this).val();
            p = 1;
            $("#city").html("<option value=''>请选择城市</option>");
            $("#area").html("<option value=''>请选择区域</option>");
            $.post("city/city",{province_id:prov_id},function(data){
                if(data!=null&&data.length>0){
                    for(var i=0;i<data.length;i++){
                        $("#city").append("<option value="+data[i].city_id+">"+data[i].city_name+"</option>");
                    }
                }
            });
        });
    	
    	$("#city").change(function area(){
            var city_id = $(this).val();
            c = 1;
            $("#area").html("<option value=''>请选择区域</option>");
            $.post("city/county",{city_id:city_id},function(data){
                if(data!=null&&data.length>0){
                    for(var i=0;i<data.length;i++){
                        $("#area").append("<option value="+data[i].county_id+">"+data[i].county_name+"</option>");
                    }
                }
            });
        });
    	
    	$("#area").change(function area(){
           t = 1;
        });
    });
    $(function() {
	//判断输入的姓名是否合理
    $("#1").change(function(){
        var name=$(this).val();
        var pattern = /^([\u4e00-\u9fa5]|[a-z]|[A-Z]){1,100}/;
        var flag = pattern.test(name);
        if(flag==true){
            $("#message1").css("font-weight","blod").css("color","green");
            $("#message1").html("     √");
            a1=1;
        }else{
            a1=0;
            $("#message1").css("font-weight","blod").css("color","red");
            $("#message1").html("  请输入正确的姓名");
        }
    });
	
  //判断输入的电话是否合理
    $("#2").change(function(){
        var tel=$(this).val();
        var pattern =  /^[1][0-9]{10}$/;
        var flag = pattern.test(tel);
        if(flag==true){
            a2=1;
            $("#message2").css("font-weight","blod").css("color","green");
            $("#message2").html("     √");
        }else{
            a2=0;
            $("#message2").css("font-weight","blod").css("color","red");
            $("#message2").html("  请输入正确的电话号码");
        }
    });
	
    //判断输入的账号是否合理
    $("#3").change(function(){
        var account=$(this).val();
        var pattern =/^([a-z]|[A-Z]|[0-9]){1,100}$/;
        var flag = pattern.test(account);
        if(flag==true){
            $.post("sys/account",{account:account},function(data){
            	if (data > 0) {
            		 a3=0;
            		 $("#message3").css("font-weight","blod").css("color","red");
                     $("#message3").html("  账号重复");
            	}else {
            		a3=1;
                    $("#message3").css("font-weight","blod").css("color","green");
                    $("#message3").html("     √");
            	}
            })
            
        }else{
            a3=0;
            $("#message3").css("font-weight","blod").css("color","red");
            $("#message3").html("  请输入正确的账号");
        }
    });
	
  //判断输入的邮箱是否合理
    $("#4").change(function(){
        var email=$(this).val();
        var pattern =/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
        var flag = pattern.test(email);
        if(flag==true){
            a4=1;
            $("#message4").css("font-weight","blod").css("color","green");
            $("#message4").html("     √");
        }else{
            a4=0;
            $("#message4").css("font-weight","blod").css("color","red");
            $("#message4").html("  请输入正确的邮箱");
        }
    });
  
  //判断输入的身份证是否合理
    $("#5").change(function(){
        var identity=$(this).val();
        var pattern =/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/;
        var flag = pattern.test(identity);
        if(flag==true){
        	 $.post("sys/identity",{identity:identity},function(data){
             	if (data > 0) {
             		 a5=0;
             		 $("#message5").css("font-weight","blod").css("color","red");
                     $("#message5").html("  身份证重复");
             	}else {
             		 a5=1;
                     $("#message5").css("font-weight","blod").css("color","green");
                     $("#message5").html("     √");
             	}
             })
        }else{
            a5=0;
            $("#message5").css("font-weight","blod").css("color","red");
            $("#message5").html("  请输入正确的身份证");
        }
    });
  //判断输入的具体地址
    $("#6").change(function(){
        var address=$(this).val();
        if(address != null && address != ""){
            a6=1;
            $("#message6").css("font-weight","blod").css("color","green");
            $("#message6").html("     √");
        }else{
            a6=0;
            $("#message6").css("font-weight","blod").css("color","red");
            $("#message6").html("  请输入具体地址");
        }
    });
  
    });
	

function sub() {
    if(a1 == 0){
    	alert("请输入正确的姓名");
    }else if(a2 == 0){
    	alert("请输入正确的电话号码");
    }else if(a3 == 0){
    	alert("请输入正确的账号");
    }else if(a4 == 0){
        alert("请输入正确的邮箱");
    }else if(a5 == 0){
    	alert("请输入正确的身份证");
    }else if(a6 == 0){
    	alert("请输入具体地址")
    }else if(p == 0){
    	alert("请选择省份")
    }else if(c == 0){
    	alert("请选择城市")
    }else if(t == 0){
    	alert("请选择地区")
    }else if(a1!=0&&a2!=0&&a3!=0&&a4!=0&&a5!=0&&a6!=0&&p!=0&&c!=0&&t!=0){
    	$("#addForm").submit();
    }
	
}

$(function(){
	var m = $("#m").val();
	if (m!=null && m!="") {
		alert(m);
	}
	$("#m").val("");
})
    </script>
</head>
<body data-type="generalComponents">
<input type="hidden" value="${m }" id="m">
<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-topbar-brand">
    </div>
    <div class="am-icon-list tpl-header-nav-hover-ico am-fl am-margin-right">

    </div>

    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>

    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="am-icon-bell-o"></span> 提醒 <span class="am-badge tpl-badge-success am-round">0</span></span>
                </a>
                <ul class="am-dropdown-content tpl-dropdown-content">
                    <li class="tpl-dropdown-content-external">
                        <h3>你有 <span class="tpl-color-success">5</span> 条提醒</h3><a href="###">全部</a></li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-plus tpl-dropdown-ico-btn-size tpl-badge-success"></span> 【预览模块】移动端 查看时 手机、电脑框隐藏。</a>
                        <span class="tpl-dropdown-list-fr">3小时前</span>
                    </li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-check tpl-dropdown-ico-btn-size tpl-badge-danger"></span> 移动端，导航条下边距处理</a>
                        <span class="tpl-dropdown-list-fr">15分钟前</span>
                    </li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-bell-o tpl-dropdown-ico-btn-size tpl-badge-warning"></span> 追加统计代码</a>
                        <span class="tpl-dropdown-list-fr">2天前</span>
                    </li>
                </ul>
            </li>
            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="am-icon-calendar"></span> 进度 <span class="am-badge tpl-badge-primary am-round">0</span></span>
                </a>
                <ul class="am-dropdown-content tpl-dropdown-content">
                    <li class="tpl-dropdown-content-external">
                        <h3>你有 <span class="tpl-color-primary">4</span> 个任务进度</h3><a href="###">全部</a></li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                                <span class="task">
                        <span class="desc">Amaze UI 用户中心 v1.2 </span>
                                <span class="percent">45%</span>
                                </span>
                                <span class="progress">
                        <div class="am-progress tpl-progress am-progress-striped"><div class="am-progress-bar am-progress-bar-success" style="width:45%"></div></div>
                    </span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                                <span class="task">
                        <span class="desc">新闻内容页 </span>
                                <span class="percent">30%</span>
                                </span>
                                <span class="progress">
                       <div class="am-progress tpl-progress am-progress-striped"><div class="am-progress-bar am-progress-bar-secondary" style="width:30%"></div></div>
                    </span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                                <span class="task">
                        <span class="desc">管理中心 </span>
                                <span class="percent">60%</span>
                                </span>
                                <span class="progress">
                        <div class="am-progress tpl-progress am-progress-striped"><div class="am-progress-bar am-progress-bar-warning" style="width:60%"></div></div>
                    </span>
                        </a>
                    </li>

                </ul>
            </li>
            <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen" class="tpl-header-list-link"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
        </ul>
    </div>
</header>







    <div class="tpl-page-container tpl-page-header-fixed">
        <div class="tpl-left-nav tpl-left-nav-hover">
            <div class="tpl-left-nav-title">
                功能列表
            </div>
            <div class="tpl-left-nav-list">
                <ul class="tpl-left-nav-menu">
                    <li class="tpl-left-nav-item">
                        <a href="首页.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-home"></i>
                            <span>首页</span>
                        </a>
                    </li>
                    <li class="tpl-left-nav-item">
                        <a href="订单管理.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-bar-chart"></i>
                            <span>订单管理</span>
                        </a>
                    </li>

                    <li class="tpl-left-nav-item">
                        <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-table"></i>
                            <span>客户管理</span>
                            <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                        </a>
                        <ul class="tpl-left-nav-sub-menu">
                            <li>
                                <a href="公司管理.html">
                                    <i class="am-icon-angle-right"></i>
                                    <span>公司管理</span>
                                </a>

                                <a href="联系人管理.html">
                                    <i class="am-icon-angle-right"></i>
                                    <span>联系人管理</span>
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="tpl-left-nav-item">
                        <a href="行程管理.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-table"></i>
                            <span>行程管理</span>
                        </a>
                    </li>


                    <li class="tpl-left-nav-item">
                        <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-wpforms"></i>
                            <span>业绩分析</span>
                            <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                        </a>
                        <ul class="tpl-left-nav-sub-menu" style="display: block;">
                            <li>
                                <a href="个人业绩.html">
                                    <i class="am-icon-angle-right"></i>
                                    <span>个人业绩</span>

                                </a>

                                <a href="总体业绩.html">
                                    <i class="am-icon-angle-right"></i>
                                    <span>总体业绩</span>
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="tpl-left-nav-item">
                        <a href="修改密码.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-key"></i>
                            <span>修改密码</span>

                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="tpl-content-wrapper">
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                    <div class="caption font-green bold">
                        个人信息
                    </div>
                </div>
                <div class="tpl-block ">

                    <div class="am-g tpl-amazeui-form">


                        <div class="am-u-sm-12 am-u-md-9">
                            <form class="am-form am-form-horizontal" id="addForm" method="post" action="sys/addUser">
                                <div class="am-form-group">
                                    <label for="1" class="am-u-sm-3 am-form-label">员工名</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="1" name="user_name" placeholder="Name of operator" value="">
                                        <font id="message1"></font>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">性别</label>
                                    <div class="am-u-sm-9">
                                        <select name="user_sex">
                                       		<option value="1" selected="selected">男</option>
                                           	<option value="2">女</option>
                                        </select>
                                    </div>
                                </div>
								<div class="am-form-group">
                                    <label for="2" class="am-u-sm-3 am-form-label">电话 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="2" name="user_tel" placeholder="Tel"  value="" maxlength="11">
                                         <font id="message2"></font>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label for="3" class="am-u-sm-3 am-form-label">账号 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="3" name="user_account" placeholder="Account"  value="">
                                         <font id="message3"></font>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label for="4" class="am-u-sm-3 am-form-label">邮箱 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="4" name="user_email" placeholder="E-mail"  value="">
                                         <font id="message4"></font>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label for="5" class="am-u-sm-3 am-form-label">身份证</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="5" name="user_identity" placeholder="Identification card"  value="" maxlength="18">
                                         <font id="message5"></font>
                                    </div>
                                </div>
								<div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">公司地址</label>
                                    <div class="am-u-sm-9">
                                        <input type="hidden" name="company_prov" id="company_prov">
                                        <select name="user_prov" id="province">
                                            <option>请选择公司所在省</option>
                                        </select>
                                        <input type="hidden" name="company_city" id="company_city">
                                        <select name="user_city" id="city">
                                            <option>请选择公司所在市</option>
                                        </select>
                                        <input type="hidden" name="company_area" id="company_area">
                                        <select name="user_area" id="area">
                                            <option>请选择公司所在区县</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label for="6" class="am-u-sm-3 am-form-label">具体地址</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" id="6" name="user_address" placeholder="The specific address" value="">
                                         <font id="message6"></font>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button type="button" class="am-btn am-btn-primary" onclick="sub()">保存修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/app.js"></script>
</body>

</html>